/**
 * 2018年12月23日下午5:16:35
 * @author 谢进财
 */
package com.baihang.project.ds.dao;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.baihang.framework.dao.BaseDao;
import com.baihang.platform.controller.IndexController;
import com.baihang.project.ds.entity.MenuEntity;
import com.baihang.project.ds.entity.dbMap.MenuEntityRowMapper;
import com.baihang.project.ds.model.EmployeeModel;
import com.baihang.project.ds.model.dbMap.EmployeeRowMapper;

/**
 * @author whati
 *
 */
@Repository
public class EmployeeDao extends BaseDao {
	private static Logger logger = LoggerFactory.getLogger(EmployeeDao.class);
	@Autowired
	private MenuEntityRowMapper rowMapper;
	@Autowired
	private EmployeeRowMapper employeeRowMapper;
	public  MenuEntity  getMenuEntity(String sql) {
		MenuEntity  entity = super.getJdbcTemplate().queryForObject(sql, rowMapper);	
		return entity;
	}
	
	public List<MenuEntity> getMenuEntityList(String sql){
		List<MenuEntity> list = super.getJdbcTemplate().query(sql, rowMapper);
		return list;
	}
	
	public EmployeeModel getEmployeeModel(String sql ) {
		try {
			EmployeeModel model = super.getJdbcTemplate().queryForObject(sql, employeeRowMapper);
			return model;
		}catch(Exception ex) {
			logger.info(ex.getMessage());
			return null;
		}
	}
	
	public List<EmployeeModel> getEmployeeModelList(String sql){
		try {
			List<EmployeeModel> list = super.getJdbcTemplate().query(sql, employeeRowMapper);
			return list;		
		}catch(Exception ex) {
			logger.info("用户集合为空");
			return null;
		}
	}
}
